﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Rocket.Windows.Framework;
using Rocket.Bll.Models;
using Rocket.Core.Common;
using Rocket.Core;

namespace MainForm.ChildControls
{
    public partial class QuestionData : BaseDataEditor
    {
        public QuestionData()
        {
            InitializeComponent();
        }

        public override void SetRocketBindingSource(ref BindingSource raptorBindingSource)
        {
            raptorBindingSource = questionViewBindingSource;
        }

        public override void RocketBindingSourceChanged(object sender, EventArgs e)
        {
            // throw new NotImplementedException();
        }

        public override V MapIt<V>(int Id, V bindedView)
        {
            BaseObject view = bindedView;
            if (view == null)
                view = new QuestionView();
            if (Id == 0)
                view.IsNew = true;
            view.Id = Id;
            ((QuestionView)view).QuestionId = DataManager.ConvertToInt(questionIdTextBox.Text);
            ((QuestionView)view).Text = textTextBox.Text;
            return ((V)view);
        }
    }
}
